import Cookies from 'js-cookie'
const expires = 1

export const TOKEN_KEY = 'access_token'
export const REFRESH_TOKEN_KEY = 'refresh_token'

export const setAccessToken = token => {
  Cookies.set(TOKEN_KEY, token, { expires })
}
export const getAccessToken = () => {
  const token = Cookies.get(TOKEN_KEY)
  if (token) return token
  else return false
}
export const setRefreshToken = token => {
  Cookies.set(REFRESH_TOKEN_KEY, token, { expires })
}
export const getRefreshToken = () => {
  const token = Cookies.get(REFRESH_TOKEN_KEY)
  if (token) return token
  else return false
}
